{% import 'Import/app_import.html.twig' as appImport %}
<!DOCTYPE html>
<html lang="{{ app.request.locale }}">
<head>
<meta charset="UTF-8">
<title>{% block head_title %}elasticsearch-admin{% endblock %}</title>
<meta name="robots" content="noindex, nofollow, noarchive">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="HandheldFriendly" content="true">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="mobile-web-app-capable" content="yes">
<meta name="theme-color" content="#343a40">
<link rel="apple-touch-icon" sizes="512x512" href="{{ asset('favicon-gray-512.png') }}">
<link rel="apple-touch-icon-precomposed" sizes="512x512" href="{{ asset('favicon-gray-512.png') }}">
{% if firewall and is_granted('IS_AUTHENTICATED_FULLY', app.user) %}
<link rel="shortcut icon" href="{{ asset('favicon-' ~ cluster_health['status'] ~ '-64.png') }}">
{% else %}
<link rel="shortcut icon" href="{{ asset('favicon-gray-64.png') }}">
{% endif %}
<link rel="manifest" href="{{ asset('site.webmanifest') }}">
{% block styles %}
{{ encore_entry_link_tags('app-css') }}
{% endblock %}
</head>
<body class="{{ theme_body }}">
<div class="container-fluid">
    {% if 'offline' != app.request.attributes.get('_route') %}
        <div id="toast-container">
        </div>
        <nav class="navbar {{ theme_navbar }}">
            <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="{{ 'toggle_navigation'|trans }}">
                <span class="navbar-toggler-icon"></span>
            </button>
            <div class="collapse navbar-collapse" id="navbarNavAltMarkup">
                <ul class="navbar-nav">
                    {% if firewall and is_granted('IS_AUTHENTICATED_FULLY', app.user) %}
                        <li class="nav-item">
                            <a class="nav-link {{ theme_nav_link }}" href="{{ path('cluster') }}">{{ 'cluster'|trans }}{{ appImport.badge({'title': root['version']['number'], 'context': cluster_health['status']}) }}</a>
                        </li>

                        {% if is_granted('NODES_LIST', 'node') %}
                            <li class="nav-item">
                                <a class="nav-link {{ theme_nav_link }}" href="{{ path('nodes') }}">{{ 'nodes'|trans }}</a>
                            </li>
                        {% endif %}

                        {% if is_granted('INDICES_LIST', 'index') %}
                            <li class="nav-item">
                                <a class="nav-link {{ theme_nav_link }}" href="{{ path('indices') }}">{{ 'indices'|trans }}</a>
                            </li>
                        {% endif %}

                        {% if is_granted('SHARDS', 'global') %}
                            <li class="nav-item">
                                <a class="nav-link {{ theme_nav_link }}" href="{{ path('shards') }}">{{ 'shards'|trans }}</a>
                            </li>
                        {% endif %}

                        {% if menus['configuration'] is defined %}
                            <li class="nav-item dropdown">
                                <a class="nav-link {{ theme_nav_link }} dropdown-toggle" href="#" id="configurationDropdown" role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                                    {{ 'configuration'|trans }}
                                </a>
                                <div class="dropdown-menu {{ theme_dropdown_menu }}" aria-labelledby="configurationDropdown">
                                    {% for entry in menus['configuration'] %}
                                        <a class="dropdown-item" href="{{ path(entry['path']) }}">{{ entry['name'] }}</a>
                                    {% endfor %}
                                </div>
                            </li>
                        {% endif %}

                        {% if menus['tools'] is defined %}
                            <li class="nav-item dropdown">
                                <a class="nav-link {{ theme_nav_link }} dropdown-toggle" href="#" id="toolsDropdown" role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                                    {{ 'tools'|trans }}
                                </a>
                                <div class="dropdown-menu {{ theme_dropdown_menu }}" aria-labelledby="toolsDropdown">
                                    {% for entry in menus['tools'] %}
                                        <a class="dropdown-item" href="{{ path(entry['path']) }}">{{ entry['name'] }}</a>
                                    {% endfor %}
                                </div>
                            </li>
                        {% endif %}

                        {% if menus['stats'] is defined %}
                            <li class="nav-item dropdown">
                                <a class="nav-link {{ theme_nav_link }} dropdown-toggle" href="#" id="statsDropdown" role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                                    {{ 'stats'|trans }}
                                </a>
                                <div class="dropdown-menu {{ theme_dropdown_menu }}" aria-labelledby="statsDropdown">
                                    {% for entry in menus['stats'] %}
                                        <a class="dropdown-item" href="{{ path(entry['path']) }}">{{ entry['name'] }}</a>
                                    {% endfor %}
                                </div>
                            </li>
                        {% endif %}

                        {% if menus['application'] is defined %}
                            <li class="nav-item dropdown">
                                <a class="nav-link {{ theme_nav_link }} dropdown-toggle" href="#" id="applicationDropdown" role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                                    {{ 'application'|trans }}
                                </a>
                                <div class="dropdown-menu {{ theme_dropdown_menu }}" aria-labelledby="applicationDropdown">
                                    <h6 class="dropdown-header">elasticsearch-admin</h6>
                                    <a class="dropdown-item d-none" href="#" id="button_install">{{ 'add_to_home_screen'|trans }}</a>
                                    {% for entry in menus['application'] %}
                                        <a class="dropdown-item" href="{{ path(entry['path']) }}">{{ entry['name'] }}</a>
                                    {% endfor %}
                                    <div class="dropdown-divider"></div>
                                    <a class="dropdown-item" rel="noreferrer" target="_blank" href="https://hub.docker.com/r/stephanediondev/elasticsearch-admin">{{ 'docker_hub'|trans }}</a>
                                    <a class="dropdown-item" rel="noreferrer" target="_blank" href="https://github.com/stephanediondev/elasticsearch-admin">{{ 'github'|trans }}</a>
                                </div>
                            </li>
                        {% endif %}

                        <li class="nav-item dropdown">
                            <a class="nav-link {{ theme_nav_link }} dropdown-toggle" href="#" id="userDropdown" role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                                {{ app.user.email }}
                            </a>
                            <div class="dropdown-menu {{ theme_dropdown_menu }}" aria-labelledby="userDropdown">
                                {% if is_granted('APP_SUBSCRIPTIONS', 'global') %}
                                    <a class="dropdown-item" href="{{ path('app_subscriptions') }}">{{ 'subscriptions'|trans }}</a>
                                {% endif %}
                                <a class="dropdown-item" href="{{ path('app_users_profile') }}">{{ 'profile'|trans }}</a>
                                <a class="dropdown-item" href="{{ path('app_theme_editor') }}">{{ 'theme_editor'|trans }}</a>
                                <a class="dropdown-item" href="{{ path('app_logout') }}">{{ 'logout'|trans }}</a>
                            </div>
                        </li>
                    {% else %}
                        <li class="nav-item">
                            <a class="nav-link {{ theme_nav_link }}" href="{{ path('app_login') }}">{{ 'login'|trans }}</a>
                        </li>
                    {% endif %}
                </ul>
            </div>
        </nav>
    {% endif %}

    {% block heading_1 %}
    {% endblock %}

    {% for label, messages in app.flashes %}
        {% for message in messages %}
            <div class="alert alert-{{ label }} alert-dismissible fade show" role="alert">
                {{ message|trans }}
                <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="{{ 'close'|trans }}"></button>
            </div>
        {% endfor %}
    {% endfor %}

    {% block heading_2 %}
    {% endblock %}

    {% block tabs %}
    {% endblock %}

    {% block form_search %}
    {% endblock %}

    {% block main_content %}
    {% endblock %}
</div>
{% block scripts %}
<script type="text/javascript">
var app_base_url = '{{ path('app_login') }}';
var trans_required = '{{ 'required'|trans|escape('js') }}';
var theme_link_primary = '{{ theme_link_primary }}';
var theme_link_secondary = '{{ theme_link_secondary }}';
var theme_form_required = '{{ theme_form_required }}';
var theme_color_1 = '{{ theme_color_1 }}';
var theme_color_2 = '{{ theme_color_2 }}';
</script>
{{ encore_entry_script_tags('app-js') }}
{% endblock %}
</body>
</html>
